Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CERTTF-457] feat: Github action for retrieving data from multi-device jobs #434

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

boukeas
Copy link
Contributor

@boukeas boukeas commented Dec 20, 2024

Description

This PR introduces a Testflinger Github action that polls a multi-device job (receiving its ID as its input) and returns the job IDs and machine IPs of its child jobs as a JSON string.

Resolved issues

Resolves CERTTF-457.

Tests

The workflow below was used to submit a multi-device job without polling, use the poll-multi action to retrieve the data for the child jobs, and then display that data and confirm it's valid JSON.

name: Temporary workflow for testing multi-device polling action
on:
  push:
  workflow_dispatch:

jobs:
  submit-and-poll:
    name: Submit multi-device job and poll it for its data
    runs-on: [self-hosted, testflinger]
    steps:

    - name: Submit job to Testflinger
      id: submit
      uses: canonical/testflinger/.github/actions/submit@main
      with:
        poll: false
        job: |
          job_queue: multi-1
          name: multi-device-job
          output_timeout: 43200
          provision_data:
            jobs: 
            - job_queue: 202407-34216
              name: dell-xps-13-9350-0cc9-c34216
              reserve_data:
                ssh_keys:
                - lp:boukeas
                timeout: 600
            - job_queue: 202008-28168
              name: hp-eliteone800-g627-all-in-one-pc-c28168
              reserve_data:
                ssh_keys:
                - lp:boukeas
                timeout: 600
    - name: Retrieve multi-device job data
      id: poll
      uses: canonical/testflinger/.github/actions/poll-multi@CERTTF-457-multi-device-polling
      with:
        job-id: ${{ steps.submit.outputs.id }}
    
    - name: Verify
      shell: bash
      env:
        JOBS: ${{ steps.poll.outputs.jobs }}
      run: |
        echo $JOBS
        echo $JOBS | jq

Here is a successful test run. This is the output of the action:

{
  "7fcc82b1-1ab8-4fcc-9e3f-b0f9afbcec49": "10.102.182.56",
  "52fa5098-eb7d-4084-b9b0-b830214c089f": "10.102.161.241"
}

A syntactically incorrect version of the job was also submitted, to test that the action detects provisioning (i.e. allocation) failures for multi-device jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant